From 01d69d97d154e5f2a8729fa28b3f440d3360007a Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Sat, 24 Sep 2022 08:09:58 -0600 Subject: [PATCH] fix Qt version dependencies (#922) * fix some Qt version dependencies. * disable strptime warning. --- CMakeLists.txt | 2 ++ gui/formatload.cc | 10 +++++++--- gui/mainwindow.cc | 4 ++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a8198234..f7e82bd3e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -293,6 +293,8 @@ if(UNIX) set(SOURCES ${SOURCES} gbser_posix.cc) set(HEADERS ${HEADERS} gbser_posix.h) target_compile_options(gpsbabel PRIVATE -Wall) + # disable warning from strptime.c, which we don't want to own or modify + set_source_files_properties(strptime.c PROPERTIES COMPILE_OPTIONS -Wno-unused-but-set-variable) endif() if(WIN32) diff --git a/gui/formatload.cc b/gui/formatload.cc index a0af91be6..23d24fb39 100644 --- a/gui/formatload.cc +++ b/gui/formatload.cc @@ -25,9 +25,6 @@ #include // for QByteArray #include // for operator==, QChar #include // for QCoreApplication -#ifdef GENERATE_CORE_STRINGS -#include // for QDebug, operator<< -#endif #include // for QObject #include // for QProcess #include // for QRegularExpression @@ -37,6 +34,9 @@ #include // for QVariant #include // for QApplication #include // for QMessageBox +#ifdef GENERATE_CORE_STRINGS +#include // for QT_VERSION, QT_VERSION_CHECK +#endif #include "appname.h" // for appName @@ -48,7 +48,11 @@ extern QTextStream* generate_output_stream; static QString xlt(const QString& f) { #ifdef GENERATE_CORE_STRINGS +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + *generate_output_stream << "QT_TRANSLATE_NOOP(\"core\",\"" << f << "\")" << endl; +#else *generate_output_stream << "QT_TRANSLATE_NOOP(\"core\",\"" << f << "\")" << Qt::endl; +#endif #endif return QCoreApplication::translate("core", f.toUtf8().constData()); } diff --git a/gui/mainwindow.cc b/gui/mainwindow.cc index 4c4c27d73..ac0643bde 100644 --- a/gui/mainwindow.cc +++ b/gui/mainwindow.cc @@ -271,7 +271,11 @@ void MainWindow::switchTranslator(QTranslator& translator, const QString& filena const QStringList directories = { QApplication::applicationDirPath() + "/translations", ":/translations", +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) QLibraryInfo::location(QLibraryInfo::TranslationsPath) +#else + QLibraryInfo::path(QLibraryInfo::TranslationsPath) +#endif }; // Load the new translator. -- 2.30.2